package com.smart.platform.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.smart.platform.entity.Score;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface ScoreMapper extends BaseMapper<Score> {

    @Select("SELECT AVG(total) FROM score where classes= #{classes} and grade = #{grade} and state = #{state}")
    float selectTotalAvg(Integer classes, Integer grade, Integer state);

    @Select("SELECT MAX(total) FROM score where classes= #{classes} and grade = #{grade} and state = #{state}")
    float selectTotalMax(Integer classes, Integer grade, Integer state);

    @Select("SELECT MIN(total) FROM score where classes= #{classes} and grade = #{grade} and state = #{state}")
    float selectTotalMin(Integer classes, Integer grade, Integer state);

    @Select("SELECT AVG(chinese) FROM score where classes= #{classes} and grade = #{grade} and state = #{state}")
    float selectChineseAvg(Integer classes, Integer grade, Integer state);

    @Select("SELECT AVG(math) FROM score where classes= #{classes} and grade = #{grade} and state = #{state}")
    float selectMathAvg(Integer classes, Integer grade, Integer state);

    @Select("SELECT AVG(english) FROM score where classes= #{classes} and grade = #{grade} and state = #{state}")
    float selectEnglishAvg(Integer classes, Integer grade, Integer state);

    @Select("SELECT AVG(physics) FROM score where classes= #{classes} and grade = #{grade} and state = #{state}")
    float selectPhysicsAvg(Integer classes, Integer grade, Integer state);

    @Select("SELECT AVG(chemistry) FROM score where classes= #{classes} and grade = #{grade} and state = #{state}")
    float selectChemistryAvg(Integer classes, Integer grade, Integer state);

    @Select("SELECT AVG(biology) FROM score where classes= #{classes} and grade = #{grade} and state = #{state}")
    float selectBiologyAvg(Integer classes, Integer grade, Integer state);

    @Select("SELECT AVG(political) FROM score where classes= #{classes} and grade = #{grade} and state = #{state}")
    float selectPoliticalAvg(Integer classes, Integer grade, Integer state);

    @Select("SELECT AVG(history) FROM score where classes= #{classes} and grade = #{grade} and state = #{state}")
    float selectHistoryAvg(Integer classes, Integer grade, Integer state);

    @Select("SELECT AVG(geography) FROM score where classes= #{classes} and grade = #{grade} and state = #{state}")
    float selectGeographyAvg(Integer classes, Integer grade, Integer state);


}
